<%@ page language="java" import="java.util.*,com.beans.*,com.dao.*" pageEncoding="UTF-8"%>   
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>  
<html>
  <head>
    <base href="<%=basePath%>">  
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="css/basestyle.css"></link>
		<link rel="stylesheet" type="text/css" href="css/maintable.css"></link>
		<style>
		
					#div_content ul{
							padding:0;
							margin:0;
							display:inline-block;
							width:100%;
					}
					
					#div_content li{
							margin-top:20px;
							width:214px;
							list-style:none;
							float:left;
							text-align:center;
					}
					
					.div_catetitle{
						 clear:both;
						 height:33px;
						 border: 1px solid #888888;
						
						 border-left:0px;
						 border-right:0px;
						 border-bottom: #4380CC 4px solid;
						 padding-left:30px;
						 padding-right:30px;	
					}
					
					.img_left{
						float:left;
						margin-top:5px;
						font-weight:bold;
						font-family:黑体;
						color:#3F3F3F;
						padding-left:12px;
						background:url(images/Icon_TeJia.gif) no-repeat;
						padding-top:4px;
					
					}
					
					.img_right{
						float:right;
						margin-top:8px;
					}
					
					
					/*商品图片*/
					.goods_pic{
						width:99px;
						height:99px;
						margin-bottom:10px;
					}

					#div_content a img{
						border:none;
						border:0px;
					}
			</style>
  </head>
  
  <body>
		 <%
			 MemberInfo user=(MemberInfo)session.getAttribute("user");
		 %>
  		<%
			//初始化商品列表,提取的是第一个大分类,下所有的小分类
			Map<String,List<GoodsInfo>> goodsMap=new GoodsDao().getInitGoodsMap(3,4);
			request.setAttribute("goodsMap", goodsMap);
		%>
		<div id="div_content">
		<jsp:include page='<%= user==null?"top.jsp":"top_login.jsp" %>'></jsp:include>
		<c:forEach var="map" items="${goodsMap }">
				<div class="div_catetitle">
	  				<label  class="img_left">${map.key } </label>	
	  				<a href="${pageContext.request.contextPath }/GoodsServlet?flag=search"><img src="images/icon_more.gif"  class="img_right" /> </a>
	  			</div>
	  			<ul>
	  				<c:forEach var="goods" items="${map.value }">
	  					<li>  
							<%--     <img src="http://localhost:8080/shop-admin/images/upload_goodsimgs/${goods.picture }" class="goods_pic" title="${goods.goodsName }" /> --%>
							    <img src="GoodsServlet?flag=zhaopian&id=${goods.id }" class="goods_pic" title="${goods.goodsName }" />
								<div>
								<a href="goods/goodsInfo.jsp?goodsId=${goods.id }" > <img src="images/icon_car.gif" /></a> 
								<a href="ShopCartServlet?flag=add&goodsId=${goods.id }" ><img src="images/icon_buy.gif" /></a> 
								</div>
  						</li>
	  				</c:forEach>
	  			</ul>
		</c:forEach>
		<%@ include file="bottom.jsp"%>
		</div>
		<script>
			var a = '${jiesuan_msg}';
			if(a!=""){
				alert(a);
			}
		</script>
  </body>
</html>